<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TemplateWeb.Models.ViewModels.GroupViewModel>" %>
<%@ Import Namespace="TemplateWeb.Helpers" %>
<div class="AdminPageText">
List Of BinhLuanTinTuc
</div>
<% using (Html.BeginForm("UpdateBinhLuanTinTuc", "Admin", FormMethod.Post, new { id = "MySubmitForm" })){ %>
<table class="Grid" cellpadding="0" cellspacing="0">
	<thead>
		<tr>
			<th>NoiDung</th>
			<th>TenNguoiBinhLuan</th>
			<th>NgayBinhLuan</th>
			<th></th>
			<th></th>
		</tr>
	</thead>
	<% for (int i=0; i<Model.BinhLuanTinTucModel.GetModel.LstObjModel.Count; i++){
		if (i % 2 != 0) {%>
		<tr class="Row" id="row-<%= Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].ID %>">
		<% }
		else { %>
		<tr class="AlternatingRow" id="row-<%= Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].ID %>">
		<% } %>
		<% if (Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].ID == Model.BinhLuanTinTucModel.EditModel.ID){ %>
			<td>
				<%= Html.TextBox("BinhLuanTinTuc_NoiDung", Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].NoiDung, new { @Style = ""})%>
			</td>
			<td>
				<%= Html.TextBox("BinhLuanTinTuc_TenNguoiBinhLuan", Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].TenNguoiBinhLuan, new { @Style = ""})%>
			</td>
			<td>
				<%= Html.TextBox("BinhLuanTinTuc_NgayBinhLuan", Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].NgayBinhLuan, new { @Style = ""})%>
			</td>
			<td>
				<a href="#" onclick="submitForm();">
					<span style="color: Blue; text-decoration: underline">Update</span>
				</a>
				&nbsp;
				<%= Html.Hidden("BinhLuanTinTuc_CurrentPage", Model.BinhLuanTinTucModel.GetModel.CurrentPage) %>
				<%= Html.Hidden("BinhLuanTinTuc_ID", Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].ID)%>
				<%= Html.Hidden("BinhLuanTinTuc_IDTinTuc", Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].IDTinTuc) %>
				<%= Ajax.ActionLink("Cancel", "CancelEditingBinhLuanTinTuc", "Admin", new { page = Model.BinhLuanTinTucModel.GetModel.CurrentPage }, new AjaxOptions { UpdateTargetId = "PartialDiv" })%>
			</td>
			<td>
				<%= Ajax.ActionLink("Delete", "DeleteBinhLuanTinTuc", "Admin", new { id = Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].ID }, new AjaxOptions{Confirm = "Are you sure you want to Delete it? This action cannot be undone.", HttpMethod = "Delete", OnComplete = "jsonDelete_OnComplete"})%>
			</td>
		<% }else{ %>
			<td><%= Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].NoiDung %></td>
			<td><%= Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].TenNguoiBinhLuan %></td>
			<td><%= Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].NgayBinhLuan %></td>
			<td>
				<%= Ajax.ActionLink("Edit", "EditBinhLuanTinTuc", "Admin", new { page = Model.BinhLuanTinTucModel.GetModel.CurrentPage, id = Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].ID }, new AjaxOptions { UpdateTargetId = "PartialDiv" })%>
			</td>
			<td>
				<%= Ajax.ActionLink("Delete", "DeleteBinhLuanTinTuc", "Admin", new { id = Model.BinhLuanTinTucModel.GetModel.LstObjModel[i].ID }, new AjaxOptions{Confirm = "Are you sure you want to Delete it? This action cannot be undone.", HttpMethod = "Delete", OnComplete = "jsonDelete_OnComplete"})%>
			</td>
		<% } %>
		</tr>
	<% } %>  
</table>
<% } %>
